#ifndef DIALOG_H
#define DIALOG_H

#include <QDialog>
#include <qtimer.h>
#include <QMediaPlayer>
#include <QMediaPlaylist>
#include <windows.h>
#include <sapi.h>
#include <QRandomGenerator>

QT_BEGIN_NAMESPACE
namespace Ui { class Dialog; }
QT_END_NAMESPACE

class Dialog : public QDialog
{
    Q_OBJECT

public:
    Dialog(QWidget *parent = nullptr);
    ~Dialog();

    int start_flag = 0;
    int count = 0;
    int err_show = 0;
    unsigned int noupdate_time = 0;
    QTimer *timer;
    QMediaPlayer *player;
    HRESULT hr;
    ISpVoice *pVoice = nullptr;
    QString play_str;
    QString previousStyleSheet;
    int las_time_s;

    bool update();
    void write_file();
    void play_file();
    void TTS_play();
    void check(bool if_err);
    bool sub100();
    bool sub10();


private slots:
    void on_pushButton_start_clicked();
    void onTimeout();
    void on_pushButton_ok_clicked();

    void on_lineEdit_textChanged(const QString &arg1);

private:
    Ui::Dialog *ui;
};
#endif // DIALOG_H
